<article id="wikiArticle">
<div></div>
<h2 id="信息">信息</h2>
<pre><code class="language-javascript">Warning: ReferenceError: deprecated caller usage (Firefox)
Warning: ReferenceError: deprecated arguments usage (Firefox)
TypeError: 'callee' and 'caller' cannot be accessed in strict mode. (Safari)
</code></pre>
<h2 id="错误类型">错误类型</h2>
<p>仅在严格模式下出现的 <a href="Reference/Global_Objects/ReferenceError" title="ReferenceError（引用错误） 对象代表当一个不存在的变量被引用时发生的错误。"><code>ReferenceError</code></a> 警告。<span class="short_text" id="result_box" lang="zh-CN"><span>JavaScript 的执行将不会停止。</span></span></p>
<h2 id="发生了什么">发生了什么?</h2>
<p>在 <a href="/en-US/docs/Web/JavaScript/Reference/Strict_mode">strict mode</a> 中，<a href="Reference/Global_Objects/Function/caller" title="返回调用指定函数的函数."><code>Function.caller</code></a> 和 <a href="Reference/Global_Objects/Function/arguments" title="function.arguments 属性代表传入函数的实参，它是一个类数组对象。"><code>Function.arguments</code></a> 属性是不该使用的。它们都是已经被废弃的了，因为这两者泄露了函数的调用者，是不标准的，难于优化和有这潜在的性能问题。</p>
<h2 id="实力">实力</h2>
<h3 id="废弃的_function.caller_or_arguments.callee.caller">废弃的 <code>function.caller</code> or <code>arguments.callee.caller</code></h3>
<p><a href="Reference/Global_Objects/Function/caller" title="返回调用指定函数的函数."><code>Function.caller</code></a> 和 <code><a href="/en-US/docs/Web/JavaScript/Reference/Functions/arguments/callee">arguments.callee.caller</a></code> 都是已废弃的 (详见参考文章)。</p>
<pre><code class="language-js example-bad">"use strict";

function myFunc() {
  if (myFunc.caller == null) {
    return 'The function was called from the top!';
  } else {
    return 'This function\'s caller was ' + myFunc.caller;
  }
}

myFunc();
// Warning: ReferenceError: deprecated caller usage
// "The function was called from the top!"</code></pre>
<h3 id="Function.arguments"><code>Function.arguments</code></h3>
<p><a href="Reference/Global_Objects/Function/arguments" title="function.arguments 属性代表传入函数的实参，它是一个类数组对象。"><code>Function.arguments</code></a> 已被废弃。 (详见参考文章)。</p>
<pre><code class="language-js example-bad">"use strict";

function f(n) { g(n - 1); }

function g(n) {
  console.log('before: ' + g.arguments[0]);
  if (n &gt; 0) { f(n); }
  console.log('after: ' + g.arguments[0]);
}

f(2);

console.log('returned: ' + g.arguments);
// Warning: ReferenceError: deprecated arguments usage
</code></pre>
<h2 id="相关">相关</h2>
<ul>
<li><a href="/en-US/docs/Web/JavaScript/Reference/Deprecated_and_obsolete_features">Deprecated and obsolete features</a></li>
<li><a href="/en-US/docs/Web/JavaScript/Reference/Strict_mode">Strict mode</a></li>
<li><a href="Reference/Global_Objects/Function/arguments" title="function.arguments 属性代表传入函数的实参，它是一个类数组对象。"><code>Function.arguments</code></a></li>
<li><a href="Reference/Global_Objects/Function/caller" title="返回调用指定函数的函数."><code>Function.caller</code></a> and <code><a href="/en-US/docs/Web/JavaScript/Reference/Functions/arguments/callee">arguments.callee.caller</a></code></li>
</ul>
</article>